@import "./common/vars.scss";
@import './mixins/mixins.scss';

@include b(button) {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-color: #dcdfe6;
  color: #606266;
  -webkit-appearance: none;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  margin: 0;
  transition: 0.1s;
  font-weight: 500;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  padding: 12px 20px;
  font-size: 14px;
  border-radius: 4px;
  & [class*="vw-icon-"] + span {
    margin-left: 5px;
  }

  &:hover,
  &:focus {
    color: $primary-color;
    border-color: #c6e2ff;
    background-color: #ecf5ff;
  }
  &:active {
    color: $primary-color-active;
    border-color: $primary-color-active;
    outline: none;
  }
  &.is-plain:hover,
  &.is-plain:focus {
    background: #fff;
    border-color: $primary-color;
    color: $primary-color;
  }
  &.is-plain:active {
    background: #fff;
    border-color: $primary-color-active;
    color: $primary-color-active;
    outline: none;
  }
  &.is-active {
    color: $primary-color-active;
    border-color: $primary-color-active;
  }
  &.is-round {
    border-radius: 20px;
    padding: 12px 23px;
  }
  &.is-circle {
    border-radius: 50%;
    padding: 12px;
  }
  &.is-disabled,
  &.is-disabled:hover,
  &.is-disabled:focus {
    color: #c0c4cc;
    cursor: not-allowed;
    background-image: none;
    background-color: #fff;
    border-color: #ebeef5;
  }
  &.is-loading {
    position: relative;
    pointer-events: none;
  }
  &.is-loading:before {
    pointer-events: none;
    content: "";
    position: absolute;
    left: -1px;
    top: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: inherit;
    background-color: rgba(255, 255, 255, 0.35);
  }
  @include m(primary) {
    color: #fff;
    background-color: $primary-color;
    border-color: $primary-color;
  
    &:hover,
    &:focus {
      background: #66b1ff;
      border-color: #66b1ff;
      color: #fff;
    }
    &:active {
      background: $primary-color-active;
      border-color: $primary-color-active;
      color: #fff;
      outline: none;
    }
    &.is-plain {
      color: $primary-color;
      background: #ecf5ff;
      border-color: #b3d8ff;
    }
    &.is-plain:hover,
    &.is-plain:focus {
      background: $primary-color;
      border-color: $primary-color;
      color: #fff;
    }
    &.is-disabled,
    &.is-disabled:hover,
    &.is-disabled:focus,
    &.is-disabled:active {
      color: #fff;
      background-color: #a0cfff;
      border-color: #a0cfff;
    }
  }
  @include m(success) {
    color: #fff;
    background-color: $success-color;
    border-color: $success-color;
    &:hover,
    &:focus {
      background: #85ce61;
      border-color: #85ce61;
      color: #fff;
    }
    &:active {
      background: $success-color-active;
      border-color: $success-color-active;
      color: #fff;
      outline: none;
    }
    &.is-plain {
      color: $success-color;
      background: #f0f9eb;
      border-color: #c2e7b0;
    }
    &.is-plain:hover,
    &.is-plain:focus {
      background: $success-color;
      border-color: $success-color;
      color: #fff;
    }
    &.is-plain:active {
      background: $success-color-active;
      border-color: $success-color-active;
      color: #fff;
      outline: none;
    }
    &.is-disabled,
    &.is-disabled:hover,
    &.is-disabled:focus,
    &.is-disabled:active {
      color: #fff;
      background-color: #b3e19d;
      border-color: #b3e19d;
    }
  }
  @include m(warning) {
    color: #fff;
    background-color: $warning-color;
    border-color: $warning-color;
    &:hover,
    &:focus {
      background: #ebb563;
      border-color: #ebb563;
      color: #fff;
    }
    &:active {
      background: $warning-color-active;
      border-color: $warning-color-active;
      color: #fff;
      outline: none;
    }
    &.is-plain {
      color: $warning-color;
      background: #fdf6ec;
      border-color: #f5dab1;
    }
    &.is-plain:hover,
    &.is-plain:focus {
      background: $warning-color;
      border-color: $warning-color;
      color: #fff;
    }
    &.is-plain:active {
      background: $warning-color-active;
      border-color: $warning-color-active;
      color: #fff;
      outline: none;
    }
    &.is-disabled,
    &.is-disabled:hover,
    &.is-disabled:focus,
    &.is-disabled:active {
      color: #fff;
      background-color: #f3d19e;
      border-color: #f3d19e;
    }
  }
  @include m(danger) {
    color: #fff;
    background-color: $danger-color;
    border-color: $danger-color;
  
    &:hover,
    &:focus {
      background: #f78989;
      border-color: #f78989;
      color: #fff;
    }
    &:active {
      background: $danger-color-active;
      border-color: $danger-color-active;
      color: #fff;
      outline: none;
    }
    &.is-plain {
      color: $danger-color;
      background: #fef0f0;
      border-color: #fbc4c4;
    }
    &.is-plain:hover,
    &.is-plain:focus {
      background: $danger-color;
      border-color: $danger-color;
      color: #fff;
    }
    &.is-plain:active {
      background: $danger-color-active;
      border-color: $danger-color-active;
      color: #fff;
      outline: none;
    }
    &.is-disabled,
    &.is-disabled:hover,
    &.is-disabled:focus,
    &.is-disabled:active {
      color: #fff;
      background-color: #fab6b6;
      border-color: #fab6b6;
    }
  }
  @include m(info) {
    color: #fff;
    background-color: $info-color;
    border-color: $info-color;
  
    &:hover,
    &:focus {
      background: #a6a9ad;
      border-color: #a6a9ad;
      color: #fff;
    }
    &:active {
      background: $info-color-active;
      border-color: $info-color-active;
      color: #fff;
      outline: none;
    }
    &.is-plain {
      color: $info-color;
      background: #f4f4f5;
      border-color: #d3d4d6;
    }
    &.is-plain:hover,
    &.is-plain:focus {
      background: $info-color;
      border-color: $info-color;
      color: #fff;
    }
    &.is-plain:active {
      background: $info-color-active;
      border-color: $info-color-active;
      color: #fff;
      outline: none;
    }
    &.is-disabled,
    &.is-disabled:hover,
    &.is-disabled:focus,
    &.is-disabled:active {
      color: #fff;
      background-color: #c8c9cc;
      border-color: #c8c9cc;
    }
  }
}

.vw-button--text {
  border-color: transparent;
  color: $primary-color;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  &:hover,
  &:focus {
    color: #66b1ff;
    border-color: transparent;
    background-color: transparent;
  }
  &:active {
    color: $primary-color-active;
    border-color: transparent;
    background-color: transparent;
  }
  &.is-disabled,
  &.is-disabled:hover,
  &.is-disabled:focus {
    border-color: transparent;
  }
}

.vw-button--medium {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 4px;
  &.is-round {
    padding: 10px 20px;
  }
  &.is-circle {
    padding: 10px;
  }
}

.vw-button--small {
  padding: 9px 15px;
  font-size: 12px;
  border-radius: 3px;
  &.is-round {
    padding: 9px 15px;
  }
  &.is-circle {
    padding: 9px;
  }
}

.vw-button--mini {
  padding: 7px 15px;
  font-size: 12px;
  border-radius: 3px;
  &.is-round {
    padding: 7px 15px;
  }
  &.is-circle {
    padding: 7px;
  }
}

.vw-button--tiny {
  padding: 5px 15px;
  font-size: 10px;
  border-radius: 3px;
  &.is-round {
    padding: 5px 15px;
  }
  &.is-circle {
    padding: 5px;
  }
}